home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / IBM VisualAge for Java Enterprise v4.0 Retail / ivj40 / setup / IDE.Cab / F76730_BasicStatusButtonUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-04-25  |  1.6 KB  |  45 lines

  1. package com.ibm.ivb.jface.basic;
  2.  
  3. import com.ibm.ivb.jface.plaf.StatusButtonUI;
  4. import java.awt.Insets;
  5. import javax.swing.AbstractButton;
  6. import javax.swing.JComponent;
  7. import javax.swing.border.Border;
  8. import javax.swing.border.CompoundBorder;
  9. import javax.swing.border.EmptyBorder;
  10. import javax.swing.plaf.ComponentUI;
  11. import javax.swing.plaf.basic.BasicButtonUI;
  12.  
  13. public class BasicStatusButtonUI extends StatusButtonUI {
  14.    private static final String kCBIBMCopyright = "(c) Copyright IBM Corporation 1998";
  15.    protected static BasicStatusButtonUI buttonUI;
  16.    protected static Border border;
  17.    protected static Insets margin = new Insets(0, 0, 0, 0);
  18.  
  19.    public static ComponentUI createUI(JComponent var0) {
  20.       if (buttonUI == null) {
  21.          buttonUI = new BasicStatusButtonUI();
  22.          border = new CompoundBorder(new BasicStatusBorder(), new EmptyBorder(0, 5, 0, 5));
  23.       }
  24.  
  25.       return buttonUI;
  26.    }
  27.  
  28.    public void installUI(JComponent var1) {
  29.       super.installUI(var1);
  30.       AbstractButton var2 = (AbstractButton)var1;
  31.       ((JComponent)var2).setBorder(border);
  32.       var2.setMargin(margin);
  33.       super.defaultTextShiftOffset = 1;
  34.       ((BasicButtonUI)this).setTextShiftOffset();
  35.    }
  36.  
  37.    public void uninstallUI(JComponent var1) {
  38.       super.uninstallUI(var1);
  39.       if (var1.getBorder() == border) {
  40.          var1.setBorder((Border)null);
  41.       }
  42.  
  43.    }
  44. }
  45.